#include "junix.h"

int main(int argc, char **argv)
{
	if(argc==1)
		err_quit("Usage:%s file",argv[0]);

	int fd=open(argv[1],O_CREAT|O_EXCL|O_RDWR,0644);
	if(fd==-1)
		err_sys("open");

	off_t pos;
	if( (pos=lseek(fd,1000000,SEEK_END)) == -1)
		err_sys("lseek");

	if( write(fd,"UNIX",4)!=4)
		err_sys("write");

	struct stat st;
	fstat(fd,&st);
	print_stat(&st);

	if(close(fd)==-1)
		err_sys("close");

	return 0;
}

